var btn = document.getElementById('btn');

btn.onclick = function() {

    //1.创建xmlhttprequest对象
    var xhr = new XMLHttpRequest();
    //2.请求的方法
    var method = "GET";
    //3.请求的url
    var url = "http://wthrcdn.etouch.cn/weather_mini?city=成都";
    //4.open方法，初始化请求，准备发送
    xhr.open(method, url);
    //5.发送请求，可以发送相关数据
    xhr.send()
        //6.xhr事件监听
    xhr.onreadystatechange = function() {

        if (xhr.readyState == 4) {
            var data = JSON.parse(xhr.responseText)
            console.log(data)
            console.log(data.data.ganmao)
        }
    }

}